//
//  UIFont+Extention.swift
//  FrameProduct
//
//  Created by delegate on 2024/2/3.
//


import UIKit

extension UIFont: LXSExtensionCompatible {
    
    public enum Name: String {
        case pingFangSCRegular = "PingFangSC-Regular"
        case pingFangSCMedium = "PingFangSC-Medium"
        case pingFangSCSemibold = "PingFangSC-Semibold"
     
        public func font(size: CGFloat) -> UIFont {
            UIFont.lxs.font(name: self, size: size)
        }
    }
}

public extension LXS where Base == UIFont {
    
    
    // PingFangSC-Semibold // 半粗体
    // PingFangSC-Medium   // 中
    static func font(name: UIFont.Name? = .pingFangSCRegular, size: CGFloat, weight: UIFont.Weight? = nil) -> UIFont {
        if let weight = weight {
            return UIFont.systemFont(ofSize: size, weight: weight)
        }
        else {
            if let font = UIFont(name: name?.rawValue ?? UIFont.Name.pingFangSCRegular.rawValue, size: size) {
                return font
            }
            return UIFont.systemFont(ofSize: size)
        }
    }
}

